import random

from common.exceluntil import ExcelUntil

class RegisterData():


    def randow_username(self):
        #随机生成名字
        first_name=["李","苏","汪","分","得","的","菜","真","啊","个","嘻","拍","去","不","额","嘛","来","呢","么","哦"]
        last_name=["速度","苏的","订单","的的","昂昂","大大大","订单的","我饿","大大","超出","超出菜","双方都","第三方","你你你","看看","信息","信啊","超出"]
        return random.choice(first_name)+"".join(random.choice(last_name))


    def randow_password(self):
        #随机生成密码
        number="0123456789qwertyuiopasdfghjklzxcvbnm"
        digit=random.randint(6,18)
        password=''.join(random.choice(number) for i in range(digit))
        return password
    def randow_email(self,emailtype=None,rang=None):
        #随机生成邮箱
        """随机生成邮箱"""
        __emailtype = ["@qq.com", "@163.com", "@126.com", "@189.com"]
        # 如果没有指定邮箱类型,默认在__emailtype中随机选择一个
        if emailtype == None:
            __randomemail = random.choice(__emailtype)
        else:
            __randomemail = emailtype
        # 如果没有指定邮箱长度,默认在4-10之间随机
        if rang == None:
            __rang = random.randint(4, 10)
        else:
            __rang = int(rang)
        __number = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
        __randomnumber = "".join(random.choice(__number) for i in range(__rang))
        _email = __randomnumber + __randomemail
        return _email


    def randow_mobile(self):
        #随机生成手机号
        mobile_list=["133","134""135","136","137","138","154","444","321","147","789","456"]
        number="1234567890"
        mobile = random.choice(mobile_list) + "".join(random.choice(number) for i in range(8))
        return mobile

    def randow_answer(self):
        #随机问题答案
        answer_list = ["为人性僻耽佳句,语不惊人死不休.",
                       "白发三千丈,缘愁似个长.",
                       "座客三千人，于今知有谁.",
                       "出师未捷身先死，长使英雄泪满襟。",
                       "兰陵美酒郁金香，玉碗盛来琥珀光。",
                       "庄生晓梦迷蝴蝶，望帝春心托杜鹃。",
                       "靡不有初，鲜克有终。",
                       "一唱雄鸡天下白，万方乐奏有于阗",
                       "高山仰止，景行行止",
                       "一日不见，如三月兮",
                       "有匪君子，如切如磋，如琢如磨"
                       ]
        return random.choice(answer_list)
    def all_data(self):
        """注册数据全部填写"""
        data = {}
        data["username"] = self.randow_username()
        data["email"] = self.randow_email()
        data["password"] = self.randow_password()
        data["cf_password"] = data["password"]
        data["tel"] = self.randow_mobile()
        data["answer"] = self.randow_answer()
        return data
    def data_values_for_list(self,data):
        """
        字典值转列表
        :param data: 是一个字典
        :return: 列表
        """
        values = []
        for key in data.keys():
            values.append(data[key])
        return values
if __name__ == '__main__':


    register = RegisterData()
    # print(register.randow_username)
    # print(register.randow_password)
    # print(register.randow_mobile)
    # print(register.randow_email)
    data = {
        "username":"zhangsnan",
        "password":"123456"
    }
    print(register.data_values_for_list(data))